package com.pctx.bibawxminiprogram.service;

import com.pctx.bibacommon.result.Result;
import com.pctx.bibacommon.util.DateTimeUtil;
import com.pctx.bibacommon.util.UuidUtil;
import com.pctx.bibawxminiprogram.pojo.User;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by wnf on 2018/3/9.
 */
public interface WxApiService {

    /**
     * 小程序获取openId
     *
     * @return
     * @throws Exception
     */
    public Map<String, Object> getOpenId(String js_code) throws Exception;

    /**
     * 调用小程序的接口，将前端获取的code转换为openid与sessionKey
     * @param code
     * @return
     */
    Result jscode2session(String code)throws Exception;

    /**
     * 根据本地的sessionKey来获取保存缓存在小程序上的Openid
     * @param localSessionKey
     * @return
     */
    String getOpenidByLocalSessionKey(String localSessionKey)throws Exception;

    /**
     * 解密用户敏感数据获取用户信息
     * @param encryptedData
     * @param sessionKey
     * @param iv
     * @return
     */
   Result getUserInfo(String encryptedData,String sessionKey,String iv) throws Exception;

    /**
     * 登录成功后更新小程序上的用户信息
     * @param userUuid
     * @param localSessionKey
     * @param nickName
     * @param avatarUrl
     * @param gender
     * @param province
     * @param city
     * @param country
     * @param rawData
     * @param signature
     * @return
     */
    Result updateUserInfo(String userUuid,String localSessionKey, String nickName, String avatarUrl, String gender, String province, String city, String country,
                        String rawData, String signature)throws Exception;

    /**
     * 检查用户的登录状态是否失效
     * @param localSessionKey
     * @return
     */
    Result checkSession(String localSessionKey)throws Exception;

    /**
     * 绑定手机号码给指定的用户
     * @param userUuid
     * @param Mobile
     * @return
     */
    Result bindMobileToUser(String userUuid,String Mobile)throws Exception;

    /**
     * 通过手机号码来获取验证码
     * @param Mobile
     * @return
     */
   /* Result getCaptchaByMobile(String Mobile)throws Exception;*/

    /**
     * 绑定手机号
     * @param openid
     * @param mobile
     * @return
     * @throws Exception
     */
    public Result bindMobile(String openid, String mobile) throws Exception;

    /**
     * 根据openId去取用户信息
     * @param openid
     * @return
     * @throws Exception
     */
    public Result getUserInfoByOpenid(String openid) throws Exception;
}